Eclipse Platform
Pre-release 3.0

org.eclipse.jface.text
Interface IDocumentExtension3

All Known Implementing Classes:
AbstractDocument

public interface IDocumentExtension3

Extension interface for IDocument. Adds the concept of multiple partitionings.

Since:
3.0

Field Summary
static String DEFAULT_PARTITIONING
          The identifier of the default partitioning.
 
Method Summary
 ITypedRegion[] computePartitioning(String partitioning, int offset, int length)
          Computes the partitioning of the given document range based on the given partitioning.
 String getContentType(String partitioning, int offset)
          Returns the type of the document partition containing the given offset for the given partitioning.
 IDocumentPartitioner getDocumentPartitioner(String partitioning)
          Returns the partitioner for the given partitioning or null if no partitioner is registered.
 String[] getLegalContentTypes(String partitioning)
          Returns the set of legal content types of document partitions for the given partitioning This set can be empty.
 ITypedRegion getPartition(String partitioning, int offset)
          Returns the document partition of the given partitioning in which the given offset is located.
 String[] getPartitionings()
          Returns the exisiting partitionings for this document.
 void setDocumentPartitioner(String partitioning, IDocumentPartitioner partitioner)
          Sets this document's partitioner.
 

Field Detail

DEFAULT_PARTITIONING

public static final String DEFAULT_PARTITIONING
The identifier of the default partitioning.

See Also:
Constant Field Values
Method Detail

getPartitionings

public String[] getPartitionings()
Returns the exisiting partitionings for this document. This includes the default partitioning.

Returns:
the existing partitionings for this document

getLegalContentTypes

public String[] getLegalContentTypes(String partitioning)
                              throws BadPartitioningException
Returns the set of legal content types of document partitions for the given partitioning This set can be empty. The set can contain more content types than contained by the result of getPartitioning(partitioning, 0, getLength()).

Parameters:
partitioning - the partitioning for which to return the legal content types
Returns:
the set of legal content types
Throws:
BadPartitioningException - if partitioning is invalid for this document

getContentType

public String getContentType(String partitioning,
                             int offset)
                      throws BadLocationException,
                             BadPartitioningException
Returns the type of the document partition containing the given offset for the given partitioning. This is a convenience method for getPartition(partitioning, offset).getType().

Parameters:
partitioning - the partitioning
offset - the document offset
Returns:
the partition type
Throws:
BadLocationException - if offset is invalid in this document
BadPartitioningException - if partitioning is invalid for this document

getPartition

public ITypedRegion getPartition(String partitioning,
                                 int offset)
                          throws BadLocationException,
                                 BadPartitioningException
Returns the document partition of the given partitioning in which the given offset is located.

Parameters:
partitioning - the document partitioning
offset - the document offset
Returns:
a specification of the partition
Throws:
BadLocationException - if offset is invalid in this document
BadPartitioningException - if partitioning is invalid for this document

computePartitioning

public ITypedRegion[] computePartitioning(String partitioning,
                                          int offset,
                                          int length)
                                   throws BadLocationException,
                                          BadPartitioningException
Computes the partitioning of the given document range based on the given partitioning.

Parameters:
partitioning - the document's partitioning
offset - the document offset at which the range starts
length - the length of the document range
Returns:
a specification of the range's partitioning
Throws:
BadLocationException - if the range is invalid in this document
BadPartitioningException

setDocumentPartitioner

public void setDocumentPartitioner(String partitioning,
                                   IDocumentPartitioner partitioner)
Sets this document's partitioner. The caller of this method is responsible for disconnecting the document's old partitioner from the document and to connect the new partitioner to the document. Informs all document partitioning listeners about this change.

Parameters:
partitioning - the partitioning for which to set the partitioner
See Also:
IDocumentPartitioningListener

getDocumentPartitioner

public IDocumentPartitioner getDocumentPartitioner(String partitioning)
Returns the partitioner for the given partitioning or null if no partitioner is registered.

Returns:
the partitioner for the given partitioning

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.